<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>生产登记复核（工序复核）</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="/bootstraptable/bootstrap-table.css" rel="stylesheet">
</head>
<body>
<div style="color: #0e9aef;">您正在做的业务是：生产管理--内部生产管理--生产登记复核</div>
<div class="container" style="margin-top: 20px;">
    <div style="text-align: right">
        <button type="button" id="sub_btn" class="btn btn-default">复核通过</button>
        <button type="button"  onclick="javascript:history.back()" class="btn btn-default">返回</button>
    </div>
    <div style="margin-top: 5px">
        <div class="panel panel-default">
            <h3 style="text-align: center;margin-top: 20px">生产登记单</h3>
            <div class="panel-body">
                <form class="form-horizontal" id="make_form">
                    <div class="form-group">
                        <div class="col-md-6">
                            <label class="control-label col-md-4">派工单编号：</label>
                            <div class="col-md-8">
                                <input type="text" readonly style="border: none;background-color: white" class="form-control" name="manufactureId" id="manufactureId">
                            </div>
                        </div>
                        <div class="col-md-6">
                            <label class="control-label col-md-4">工序名称：</label>
                            <div class="col-md-8">
                                <input type="text" readonly style="border: none;background-color: white" class="form-control" name="procedureName" id="procedureName">
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-6">
                            <label class="control-label col-md-4">负责人：</label>
                            <div class="col-md-8">
                                <input type="text"  style="border: none;border-bottom: 1px solid black" class="form-control" name="procedureResponsiblePerson" id="procedureResponsiblePerson">
                            </div>
                        </div>
                        <div class="col-md-6">
                            <label class="control-label col-md-4">设计工时数：</label>
                            <div class="col-md-8">
                                <input type="text" readonly style="border: none;background-color: white" class="form-control" name="labourHourAmount" id="labourHourAmount">
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-6">
                            <label class="control-label col-md-4">已用工时数：</label>
                            <div class="col-md-8">
                                <input type="text" readonly style="border: none;background-color: white" class="form-control" name="realLabourHourAmount" id="realLabourHourAmount">
                            </div>
                        </div>
                    </div>
                    <table  style="margin-top: 20px;" class="table table-bordered table-striped" data-toggle="table" id="make_table">
                        <thead>
                        <tr>
                            <th data-field="detailsNumber">序号</th>
                            <th data-field="productName">物料名称</th>
                            <th data-field="productId">物料编号</th>
                            <th data-field="amount">设计数量</th>
                            <th data-field="realAmount">已使用数量</th>
                            <th data-field="realAmount">本次数量</th>
                        </tr>
                        </thead>
                    </table>
                    <div class="form-group" style="margin-top: 10px">
                        <div class="col-md-6">
                            <label class="control-label col-md-4">复核人</label>
                            <div class="col-md-8">
                                <input type="text" style="border: none;border-bottom: 1px solid black" class="form-control" name="checker" id="checker">
                            </div>
                        </div>
                        <div class="col-md-6">
                            <label class="control-label col-md-4">复核时间</label>
                            <div class="col-md-8">
                                <input type="text"  readonly style="border: none;background-color: white" class="form-control" name="checkTime" id="checkTime">
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>


<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/js/plugins/layer/layer.min.js"></script>

<!-- 自定义js -->
<script src="/js/hAdmin.js?v=4.1.0"></script>
<script src="/js/currentTime.js"></script>

<!-- 第三方插件 -->
<script src="/js/plugins/pace/pace.min.js"></script>

<!--BootstrapTable-->
<script src="/bootstraptable/bootstrap-table.min.js"></script>
<script src="/bootstraptable/locale/bootstrap-table-zh-CN.min.js"></script>

<script>
    $(function (){
        let gxId = localStorage.getItem("gxId")
        let manId = localStorage.getItem("manId")
        $("#make_form #checkTime").val(add(fortime()))
        $.post("/manufacture/detail/getId", {"gxId": gxId}, function (res) {
            $("#make_form #manufactureId").val(manId)
            $("#make_form #procedureName").val(res.procedureName)
            $("#make_form #labourHourAmount").val(res.labourHourAmount)
            $("#make_form #realLabourHourAmount").val(res.realLabourHourAmount)

        })
        $.post("/manufacture/detail/getIdByDetails", {"gxId": gxId}, function (res) {
            for (let i = 0; i < res.length; i++) {
                $("#make_table").bootstrapTable("append", res[i])
            }
        })

        //点击复核通过
        $("#sub_btn").click(function (){
            let data=$("#make_table").bootstrapTable("getData")
            let dto={
                "manufactureId":$("#make_form #manufactureId").val(),
                "procedureName":$("#make_form #procedureName").val()
            }
            dto.details=data
            $.ajax({
                url: "/manufacture/procedure/updRecords",
                type: "post",
                data: JSON.stringify(dto),
                contentType: "application/json",
                success: function (data) {
                    if (data) {
                        window.location = "production_registration_reviewUI"
                    }
                }
            })
        })
    })
</script>
</body>
</html>